package org.dromara.web.appInterface;

import cn.dev33.satoken.annotation.SaIgnore;
import com.baomidou.mybatisplus.core.injector.methods.DeleteById;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.dromara.app.appParams.AppById;
import org.dromara.app.appParams.AppPageParams;
import org.dromara.app.appReturn.AppPriceLogRetuen;
import org.dromara.app.cssUtils.CssUtils;
import org.dromara.app.domain.SkAppUser;
import org.dromara.app.domain.SkWithdrawalLog;
import org.dromara.app.service.ISkAppUserService;
import org.dromara.app.service.ISkWithdrawalLogService;
import org.dromara.common.core.domain.R;
import org.dromara.web.CssUtil.CssTiXianServer;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "立即提现相关接口")
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/test")
@SaIgnore
public class AppTestInterface {

    private final CssTiXianServer cssTiXianServer;

    private final ISkAppUserService iSkAppUserService;

    private final ISkWithdrawalLogService iSkWithdrawalLogService;


    @PostMapping("/createAccounr")
    @Operation(summary = "立即提现", method = "post")
    public R<Void> getPriceLog(@RequestBody AppById logId, HttpServletRequest req) throws Exception {
         SkWithdrawalLog log = iSkWithdrawalLogService.getOneById(logId.getId()+"");
        SkAppUser skAppUser = iSkAppUserService.getUserById(log.getUserId());
         cssTiXianServer.withdrawImmediately(skAppUser,log);
        return R.ok("");
    }
}
